﻿/// <summary>
/// This programm should use a real location ID and delegated token obtained from your web site
/// or from https://dev.live.com/livedata/sdk/Default.aspx for testing purposes only
/// 
/// Have fun :-)
/// 
/// Author: Shahal Hazan
/// </summary>
using System;
using LiveConnector;

namespace UsageExample
{
    class Program
    {
        static void Main(string[] args)
        {
            ContactsManager contactsManager=  new ContactsManager();

            //You may get a a temp locationId and token from:
            // https://dev.live.com/livedata/sdk/Default.aspx
            // Usually you need 

            // The examples here are only to show you the approximate length of fields
            // they are not valid and I changed some of the characters in them!!!
            // Do not use them!
            string locationId = "ebba7f22a15028d6";
            string delegatedToken = "EwCoARAnAAAUWkziSC7RbDJKS1VkhugDegv7L0eAALil4kdeLGojrWKJVFTIzTcc%2FtEzFSNhwcc7WCAP5Nse3C9uZc5DAa0SOhy3B4apeTLrhIl5OrP1p0fdLd01nVlc0voKwbgPL15TSaxIzspYnIef8jWdH7HDDWFs8EsMfQUlCsMcJWbR7PP9cYHC9WxDoEGcS6nPWzBWA%2FCdeVhyA2YAAAjMttnh8ZnLivgAYE4OygEly4bLj2vpSMR40tpUXBPCsbT%2FBNzZfsG%2FqPTDEpcxYVwCtWXNAFxv1D9xs5APPhlPApI%2BMw0Bua8zXu6NziZEDcRo2CBWI%2BZpnSCMnPVN8wXYhV8SMf7hQ%2B3AwsR2iGNby%2B8hl9hpVsT7jP%2FuqnQT140eT1%2B4wdSz796s3q6bbOXfyKJck349z5KP4tFP6IT7KSBfV9ipM1Q%2FzeNDGvf5YHYBuAAeAvV4Kc7eTmO58rVYsNXw%2BKTCsOu9VVPdGGzPw8n3Z05U4%2BKCQU26n4gsfMgDZKhY5k8gD6txAPclSS4DmBoX3U2ry";
            var contacts = contactsManager.GetContacts(locationId, delegatedToken);
            if (contacts != null)
            {
                foreach (Contact contact in contacts)
                {
                    Console.WriteLine("First name: " + contact.Profiles.Personal.FirstName);
                }
            }
        }
    }
}
